<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>IDEA设置 | lilei</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="/images/icons/logo.png">
    <link rel="apple-touch-icon" href="/images/icons/logo.png">
    <link rel="manifest" href="/manifest.json">
    <script type="text/javascript" src="/assets/js/load.js"></script>
    <meta name="description" content="个人网站">
    <meta name="image" content="http://www.lileiblog.xyz/images/IDEA方法注释设置.png">
    <meta name="twitter:title" content="IDEA设置">
    <meta name="twitter:description" content="">
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:image" content="http://www.lileiblog.xyz/images/IDEA方法注释设置.png">
    <meta name="twitter:url" content="http://www.lileiblog.xyz/IDE/IDEA%E8%AE%BE%E7%BD%AE.html">
    <meta property="og:type" content="article">
    <meta property="og:title" content="IDEA设置">
    <meta property="og:description" content="">
    <meta property="og:image" content="http://www.lileiblog.xyz/images/IDEA方法注释设置.png">
    <meta property="og:url" content="http://www.lileiblog.xyz/IDE/IDEA%E8%AE%BE%E7%BD%AE.html">
    <meta property="og:site_name" content="lilei">
    <meta itemprop="name" content="IDEA设置">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="http://www.lileiblog.xyz/images/IDEA方法注释设置.png">
    <meta name="theme-color" content="#3eaf7c">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="msapplication-TileImage" content="/images/icons/logo.png">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="keywords" content="lilei,vue,vuepress,vuepress-theme,theme,主题,vuepress主题,blog
        ,vuepress-blog,java,python,shell,sql,golang,script,shell script,nginx,windows,去广告,androd,google drive
        ,one drive,idea,eclipse,git,小程序">
    <meta name="referrer" content="never">
    
    <link rel="preload" href="/assets/css/0.styles.8932179b.css" as="style"><link rel="preload" href="/assets/js/app.269009d6.js" as="script"><link rel="preload" href="/assets/js/3.974b9720.js" as="script"><link rel="preload" href="/assets/js/20.1fb3f255.js" as="script"><link rel="prefetch" href="/assets/js/10.5915e99b.js"><link rel="prefetch" href="/assets/js/11.ff732762.js"><link rel="prefetch" href="/assets/js/12.8bb86d91.js"><link rel="prefetch" href="/assets/js/13.18bde5b0.js"><link rel="prefetch" href="/assets/js/14.314fae34.js"><link rel="prefetch" href="/assets/js/15.0a4ff48f.js"><link rel="prefetch" href="/assets/js/16.ffaf1503.js"><link rel="prefetch" href="/assets/js/17.49a31a6e.js"><link rel="prefetch" href="/assets/js/18.7e6443bf.js"><link rel="prefetch" href="/assets/js/19.6880cc9a.js"><link rel="prefetch" href="/assets/js/21.0cd39eea.js"><link rel="prefetch" href="/assets/js/22.392d85cb.js"><link rel="prefetch" href="/assets/js/23.f50adb15.js"><link rel="prefetch" href="/assets/js/24.43e324e1.js"><link rel="prefetch" href="/assets/js/25.e3663205.js"><link rel="prefetch" href="/assets/js/26.da141fb8.js"><link rel="prefetch" href="/assets/js/27.6c05235a.js"><link rel="prefetch" href="/assets/js/28.c124245a.js"><link rel="prefetch" href="/assets/js/29.d185870d.js"><link rel="prefetch" href="/assets/js/30.8587d422.js"><link rel="prefetch" href="/assets/js/31.dc382b56.js"><link rel="prefetch" href="/assets/js/32.20ba32e9.js"><link rel="prefetch" href="/assets/js/33.6ecd7de9.js"><link rel="prefetch" href="/assets/js/34.2b91c13a.js"><link rel="prefetch" href="/assets/js/35.66ed0733.js"><link rel="prefetch" href="/assets/js/36.ce7bca84.js"><link rel="prefetch" href="/assets/js/37.d00bb5ac.js"><link rel="prefetch" href="/assets/js/38.c3ecbb6f.js"><link rel="prefetch" href="/assets/js/39.308f4175.js"><link rel="prefetch" href="/assets/js/4.520f6ecc.js"><link rel="prefetch" href="/assets/js/40.f4b98bc2.js"><link rel="prefetch" href="/assets/js/41.95fae64f.js"><link rel="prefetch" href="/assets/js/42.fe4f877b.js"><link rel="prefetch" href="/assets/js/43.ca8f222e.js"><link rel="prefetch" href="/assets/js/44.4d4ee79e.js"><link rel="prefetch" href="/assets/js/45.79178b33.js"><link rel="prefetch" href="/assets/js/46.c3817d0b.js"><link rel="prefetch" href="/assets/js/47.b8252443.js"><link rel="prefetch" href="/assets/js/48.df9d5d3b.js"><link rel="prefetch" href="/assets/js/49.d812fdb2.js"><link rel="prefetch" href="/assets/js/5.f1a24a16.js"><link rel="prefetch" href="/assets/js/50.55cfcaa8.js"><link rel="prefetch" href="/assets/js/51.b8608b02.js"><link rel="prefetch" href="/assets/js/52.52c5e00d.js"><link rel="prefetch" href="/assets/js/53.3a9bd5fb.js"><link rel="prefetch" href="/assets/js/54.a4240c13.js"><link rel="prefetch" href="/assets/js/55.01c4b876.js"><link rel="prefetch" href="/assets/js/56.f29549a3.js"><link rel="prefetch" href="/assets/js/57.01438a04.js"><link rel="prefetch" href="/assets/js/58.29bb4626.js"><link rel="prefetch" href="/assets/js/59.e8b89408.js"><link rel="prefetch" href="/assets/js/6.8c478b39.js"><link rel="prefetch" href="/assets/js/60.bedb5381.js"><link rel="prefetch" href="/assets/js/61.bdfbe584.js"><link rel="prefetch" href="/assets/js/62.cb825d1a.js"><link rel="prefetch" href="/assets/js/63.a9516572.js"><link rel="prefetch" href="/assets/js/64.aa854ed7.js"><link rel="prefetch" href="/assets/js/65.285f883d.js"><link rel="prefetch" href="/assets/js/66.12849f37.js"><link rel="prefetch" href="/assets/js/67.c18b00e4.js"><link rel="prefetch" href="/assets/js/68.fa59daa9.js"><link rel="prefetch" href="/assets/js/69.e9d5dda4.js"><link rel="prefetch" href="/assets/js/7.cfb0d0ea.js"><link rel="prefetch" href="/assets/js/70.db126cce.js"><link rel="prefetch" href="/assets/js/71.6acb04cd.js"><link rel="prefetch" href="/assets/js/72.7ff0ab11.js"><link rel="prefetch" href="/assets/js/73.9a66da79.js"><link rel="prefetch" href="/assets/js/74.0a38a030.js"><link rel="prefetch" href="/assets/js/75.7b32dbb3.js"><link rel="prefetch" href="/assets/js/8.cb9c08e5.js"><link rel="prefetch" href="/assets/js/9.ad652cfe.js"><link rel="prefetch" href="/assets/js/vendors~flowchart.110a1065.js">
    <link rel="stylesheet" href="/assets/css/0.styles.8932179b.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/images/icons/logo.png" alt="lilei" class="logo"> <span class="site-name can-hide">lilei</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/Form/" class="nav-link">
  Form
</a></div><div class="nav-item"><a href="/IDE/" class="nav-link router-link-active">
  IDE
</a></div><div class="nav-item"><a href="/Java/" class="nav-link">
  Java
</a></div><div class="nav-item"><a href="/Other/" class="nav-link">
  Other
</a></div><div class="nav-item"><a href="/Python/" class="nav-link">
  Python
</a></div><div class="nav-item"><a href="/SQL/" class="nav-link">
  SQL
</a></div><div class="nav-item"><a href="/Shell/" class="nav-link">
  Shell
</a></div><div class="nav-item"><a href="/System/" class="nav-link">
  System
</a></div> <a href="https://github.com/woytu/notes-vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/Form/" class="nav-link">
  Form
</a></div><div class="nav-item"><a href="/IDE/" class="nav-link router-link-active">
  IDE
</a></div><div class="nav-item"><a href="/Java/" class="nav-link">
  Java
</a></div><div class="nav-item"><a href="/Other/" class="nav-link">
  Other
</a></div><div class="nav-item"><a href="/Python/" class="nav-link">
  Python
</a></div><div class="nav-item"><a href="/SQL/" class="nav-link">
  SQL
</a></div><div class="nav-item"><a href="/Shell/" class="nav-link">
  Shell
</a></div><div class="nav-item"><a href="/System/" class="nav-link">
  System
</a></div> <a href="https://github.com/woytu/notes-vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>IDE</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/IDE/" aria-current="page" class="sidebar-link">IDE</a></li><li><a href="/IDE/Chrome.html" class="sidebar-link">Chrome</a></li><li><a href="/IDE/Eclipse.html" class="sidebar-link">Eclipse</a></li><li><a href="/IDE/Git使用.html" class="sidebar-link">Git使用</a></li><li><a href="/IDE/Git安装与问题.html" class="sidebar-link">Git安装与问题</a></li><li><a href="/IDE/Git服务.html" class="sidebar-link">Git服务</a></li><li><a href="/IDE/IDEA使用.html" class="sidebar-link">IDEA使用</a></li><li><a href="/IDE/IDEA插件.html" class="sidebar-link">IDEA插件</a></li><li><a href="/IDE/IDEA设置.html" class="active sidebar-link">IDEA设置</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#flag" class="sidebar-link">Flag</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#启动进入欢迎界面" class="sidebar-link">启动进入欢迎界面</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#格式化代码" class="sidebar-link">格式化代码</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#去掉提示重复代码" class="sidebar-link">去掉提示重复代码</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#去掉大小写敏感提示" class="sidebar-link">去掉大小写敏感提示</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#设置编码" class="sidebar-link">设置编码</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#设置序列化id" class="sidebar-link">设置序列化ID</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#自定义头部注释" class="sidebar-link">自定义头部注释</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#自定义模板" class="sidebar-link">自定义模板</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#自定义方法注释" class="sidebar-link">自定义方法注释</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#鼠标悬停查看注释" class="sidebar-link">鼠标悬停查看注释</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#注释自动缩进" class="sidebar-link">注释自动缩进</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#自动优化导包" class="sidebar-link">自动优化导包</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#热部署策略" class="sidebar-link">热部署策略</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#自动编译" class="sidebar-link">自动编译</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#去掉局部背景色" class="sidebar-link">去掉局部背景色</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#项目目录设置" class="sidebar-link">项目目录设置</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#pycharm" class="sidebar-link">PyCharm</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#goland" class="sidebar-link">GoLand</a></li><li class="sidebar-sub-header"><a href="/IDE/IDEA设置.html#webstorm" class="sidebar-link">WebStorm</a></li></ul></li><li><a href="/IDE/TextEditor.html" class="sidebar-link">TextTditor</a></li><li><a href="/IDE/VisualStudioCode.html" class="sidebar-link">VisualStudioCode</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="idea设置"><a href="#idea设置" class="header-anchor">#</a> IDEA设置</h1> <p></p><div class="table-of-contents"><ul><li><a href="#flag">Flag</a></li><li><a href="#启动进入欢迎界面">启动进入欢迎界面</a></li><li><a href="#格式化代码">格式化代码</a></li><li><a href="#去掉提示重复代码">去掉提示重复代码</a></li><li><a href="#去掉大小写敏感提示">去掉大小写敏感提示</a></li><li><a href="#设置编码">设置编码</a></li><li><a href="#设置序列化id">设置序列化ID</a></li><li><a href="#自定义头部注释">自定义头部注释</a></li><li><a href="#自定义模板">自定义模板</a><ul><li><a href="#预定义模板变量">预定义模板变量</a></li></ul></li><li><a href="#自定义方法注释">自定义方法注释</a></li><li><a href="#鼠标悬停查看注释">鼠标悬停查看注释</a></li><li><a href="#注释自动缩进">注释自动缩进</a></li><li><a href="#自动优化导包">自动优化导包</a></li><li><a href="#热部署策略">热部署策略</a></li><li><a href="#自动编译">自动编译</a></li><li><a href="#去掉局部背景色">去掉局部背景色</a></li><li><a href="#项目目录设置">项目目录设置</a></li><li><a href="#pycharm">PyCharm</a><ul><li><a href="#自动导包">自动导包</a></li><li><a href="#函数注释">函数注释</a></li></ul></li><li><a href="#goland">GoLand</a></li><li><a href="#webstorm">WebStorm</a></li></ul></div><p></p> <h2 id="flag"><a href="#flag" class="header-anchor">#</a> Flag</h2> <ul><li><a href="/files/IDEA%E8%AE%BE%E7%BD%AE.zip">IDEA设置.zip</a></li></ul> <p><strong>Export Settings</strong></p> <blockquote><p>导出设置时一定取消以下选项</p></blockquote> <ol><li>File templates</li> <li>File templates(schemes)</li> <li>Live templates</li> <li>Live templates(schemes)</li> <li>MavenVersion</li> <li>SDK Table</li></ol> <blockquote><p><code>File</code> -&gt; <code>Power Save Mode</code>(节电模式) 勾选后将会导致提示、自动加载等都不生效</p></blockquote> <h2 id="启动进入欢迎界面"><a href="#启动进入欢迎界面" class="header-anchor">#</a> 启动进入欢迎界面</h2> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Appearance &amp; Behavior</code> -&gt; <code>System Settings</code> <ul><li>勾选<code>Startup/Shutdown</code>下的<code>Reopen last project on startup</code>选项</li></ul></li></ul> <h2 id="格式化代码"><a href="#格式化代码" class="header-anchor">#</a> 格式化代码</h2> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>Code Style</code> <ul><li>-&gt; <code>General</code> <ul><li><code>Hard wrap at</code> 设置行宽，会在格式化的时候强制插入换行符，形成显示效果上的换行</li> <li><code>Wrap on typing</code> 在编码时，超出最大行宽，则自动换行</li></ul></li> <li>-&gt; <code>Java</code> -&gt; <code>Wrapping and Braces</code> <ul><li>勾选<code>Keep when reformatting</code>下的<code>Line breaks</code> 去除每次格式化时自动添加<code>+</code>符号</li> <li>勾选<code>Keep when reformatting</code>下的<code>Ensure right margin is not exceeded</code> 自动换行</li> <li><code>Comment at first column false</code> 代码格式化的时候保证<code>commet</code>符号在代码块附近</li></ul></li> <li>-&gt; <code>Java</code> -&gt; 右边选择<code>JavaDoc</code> <ul><li><code>Enable JavaDoc Formatting</code> 启用JavaDoc格式化</li> <li><code>Wrap at right margin</code> 右边缘换行，当最后一个单词会超出边界时，自动换行</li> <li><code>Do not wrap one line comments</code> 同一行注释不要换行</li> <li><code>Preserve line feeds</code> 保留换行</li></ul></li></ul></li></ul> <ul><li><code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>General</code> -&gt; 右边<code>Soft wrap</code> （只会在 IDEA 的显示效果上有换行的效果，实际上并没有换行符）</li></ul> <p><strong>缩进参考线</strong></p> <ul><li><code>File</code> -&gt; <code>Settings</code> -&gt; <code>Appearance &amp; Behavior</code> -&gt; <code>Appearance</code> -&gt; 右边勾选 <code>Show indent guides</code></li> <li><code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>General</code> -&gt; <code>Appearance</code> -&gt; 右边勾选 <code>Show indent guides</code></li></ul> <p><strong>垂直标尺</strong></p> <ul><li><code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>General</code> -&gt; <code>Appearance</code> <ul><li>2018之前版本，右边勾选 <code>Show right margin</code></li> <li>2018之后版本，右边勾选 <code>Show hard wrap guide</code> 或 <code>Show hard wrap and visual guides (configured in Code Style options)</code></li></ul></li></ul> <h2 id="去掉提示重复代码"><a href="#去掉提示重复代码" class="header-anchor">#</a> 去掉提示重复代码</h2> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>Inspections</code> -&gt; <code>General</code></li> <li>取消勾选<code>Duplincated File Template Usage</code>选项</li></ul> <h2 id="去掉大小写敏感提示"><a href="#去掉大小写敏感提示" class="header-anchor">#</a> 去掉大小写敏感提示</h2> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>General</code> -&gt; <code>Code Completion</code></li> <li>取消勾选<code>Match case</code>，或者<code>Case sensitive completion</code>选择<code>None</code></li></ul> <h2 id="设置编码"><a href="#设置编码" class="header-anchor">#</a> 设置编码</h2> <ul><li>打开 <code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>File Encodings</code></li></ul> <ol><li><code>Global Encoding</code> 全局编码</li> <li><code>Project Encoding</code> 项目编码</li> <li><code>Default encoding for properties files</code> 属性文件的默认编码</li> <li>勾选<code>Transparent native-to-ascii conversion</code> 从本地转换ASCII</li></ol> <h2 id="设置序列化id"><a href="#设置序列化id" class="header-anchor">#</a> 设置序列化ID</h2> <ul><li>打开 <code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>Inspections</code> -&gt; <code>Java</code> -&gt; <code>Serialization issues</code> <ul><li>勾选<code>Serializable class without 'serialVersionUID'</code></li> <li>勾选<code>'serialVersionUID' field not declared 'private static final long'</code></li></ul></li></ul> <h2 id="自定义头部注释"><a href="#自定义头部注释" class="header-anchor">#</a> 自定义头部注释</h2> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>File and Code Templates</code> -&gt; <code>Includes</code> -&gt; 在<code>File Header</code>中添加</li></ul> <div class="language-java extra-class"><pre class="language-java"><code><span class="token comment">/**
 * 
 * @Description: 
 * @Author: ${USER}
 * @File: ${NAME}.java
 * @Version: 1.0.0
 * @Time: ${DATE} ${TIME}
 * @Project: ${PROJECT_NAME}
 * @Package: ${PACKAGE_NAME}
 * @Software: ${PRODUCT_NAME}
 */</span>
</code></pre></div><ul><li>引用：打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>File and Code Templates</code> -&gt; <code>Files</code> <ul><li>在<code>Class</code>、<code>Interface</code>、<code>Enum</code>三个模板中的<code>public class ${NAME} {</code>上一行添加</li></ul></li></ul> <div class="language-groovy extra-class"><pre class="language-groovy"><code>#<span class="token function">parse</span><span class="token punctuation">(</span><span class="token string gstring">&quot;File Header.java&quot;</span><span class="token punctuation">)</span>
</code></pre></div><ul><li><a href="#webStorm">JavaScript头部注释</a></li></ul> <h2 id="自定义模板"><a href="#自定义模板" class="header-anchor">#</a> 自定义模板</h2> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>File and Code Templates</code> -&gt; <code>Files</code> -&gt; 在<code>Class</code>模板中粘贴</li></ul> <div class="language-groovy extra-class"><pre class="language-groovy"><code>#<span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token punctuation">$</span><span class="token punctuation">{</span>PACKAGE_NAME<span class="token punctuation">}</span> <span class="token operator">&amp;&amp;</span> <span class="token punctuation">$</span><span class="token punctuation">{</span>PACKAGE_NAME<span class="token punctuation">}</span> <span class="token operator">!=</span> <span class="token string gstring">&quot;&quot;</span><span class="token punctuation">)</span><span class="token keyword">package</span> <span class="token punctuation">$</span><span class="token punctuation">{</span>PACKAGE_NAME<span class="token punctuation">}</span><span class="token punctuation">;</span>#end


<span class="token keyword">import</span> org<span class="token punctuation">.</span>slf4j<span class="token punctuation">.</span>Logger<span class="token punctuation">;</span>
<span class="token keyword">import</span> org<span class="token punctuation">.</span>slf4j<span class="token punctuation">.</span>LoggerFactory<span class="token punctuation">;</span>

#<span class="token function">parse</span><span class="token punctuation">(</span><span class="token string gstring">&quot;File Header.java&quot;</span><span class="token punctuation">)</span>

<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token punctuation">$</span><span class="token punctuation">{</span>NAME<span class="token punctuation">}</span> <span class="token punctuation">{</span>

     <span class="token comment">//private static final Logger logger = LoggerFactory.getLogger(${NAME}.class);</span>
     <span class="token keyword">private</span> Logger log <span class="token operator">=</span> LoggerFactory<span class="token punctuation">.</span><span class="token function">getLogger</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">getClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
     
<span class="token punctuation">}</span>
</code></pre></div><h3 id="预定义模板变量"><a href="#预定义模板变量" class="header-anchor">#</a> 预定义模板变量</h3> <table><thead><tr><th>变量</th> <th>说明</th></tr></thead> <tbody><tr><td>${DATE}</td> <td>当前系统日期</td></tr> <tr><td>${DAY}</td> <td>当前月的日期</td></tr> <tr><td>${HOUR}</td> <td>当前时刻</td></tr> <tr><td>${MINUTE}</td> <td>当前分钟</td></tr> <tr><td>${MONTH_NAME_FULL}</td> <td>月份全称，例如: January, February, etc.</td></tr> <tr><td>${MONTH_NAME_SHORT}</td> <td>月份名称的前3个字母，例如: Jan, Feb, etc.</td></tr> <tr><td>${MONTH}</td> <td>当前月份</td></tr> <tr><td>${NAME}</td> <td>在创建文件期间在新建文件对话框中指定的文件名称</td></tr> <tr><td>${PACKAGE_NAME}</td> <td>当前所在包名</td></tr> <tr><td>${PRODUCT_NAME}</td> <td>将被创建文件所在的IDE名称</td></tr> <tr><td>${PROJECT_NAME}</td> <td>当前项目的名称</td></tr> <tr><td>${TIME}</td> <td>当前系统时间</td></tr> <tr><td>${USER}</td> <td>系统的当前用户登录名称</td></tr> <tr><td>${YEAR}</td> <td>当前年份</td></tr></tbody></table> <h2 id="自定义方法注释"><a href="#自定义方法注释" class="header-anchor">#</a> 自定义方法注释</h2> <ul><li>默认方法注释快捷键：<kbd>/**</kbd> + <kbd>Enter</kbd></li> <li>Template text</li></ul> <div class="language-groovy extra-class"><pre class="language-groovy"><code><span class="token operator">**</span>
 <span class="token operator">*</span> 
 <span class="token operator">*</span> 
<span class="token punctuation">$</span>params<span class="token punctuation">$</span>
 <span class="token operator">*</span> @<span class="token keyword">return</span> <span class="token punctuation">$</span>ruturns<span class="token punctuation">$</span>
 <span class="token operator">*</span> <span class="token annotation punctuation">@Description</span> 
 <span class="token operator">*</span> <span class="token annotation punctuation">@author</span> claer bajins<span class="token punctuation">.</span>com
 <span class="token operator">*</span> <span class="token annotation punctuation">@date</span> <span class="token punctuation">$</span>date<span class="token punctuation">$</span> <span class="token punctuation">$</span>time<span class="token punctuation">$</span>
 <span class="token operator">*</span><span class="token operator">/</span>
</code></pre></div><ul><li><code>@param</code>参数获取代码Groovy脚本</li></ul> <div class="language-groovy extra-class"><pre class="language-groovy"><code><span class="token comment">// 使用tab作为参数后缀间隔符</span>
<span class="token function">groovyScript</span><span class="token punctuation">(</span><span class="token string gstring">&quot;def result=''; def params=\&quot;<span class="token expression"><span class="token punctuation">$</span><span class="token punctuation">{</span><span class="token number">_1</span><span class="token punctuation">}</span></span>\&quot;.replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i &lt; params.size(); i++) {result+=' * @param ' + params[i]+'\\b'+ ((i &lt; params.size() - 1) ? '\\n    ' : '')}; return result&quot;</span><span class="token punctuation">,</span> <span class="token function">methodParameters</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token comment">// 使用一个空格作为参数后缀间隔符，格式化时可以自动把所有参数对齐（推荐）</span>
<span class="token function">groovyScript</span><span class="token punctuation">(</span><span class="token string gstring">&quot;def result=''; def params=\&quot;<span class="token expression"><span class="token punctuation">$</span><span class="token punctuation">{</span><span class="token number">_1</span><span class="token punctuation">}</span></span>\&quot;.replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i &lt; params.size(); i++) {result+=' * @param ' + params[i]+' '+ ((i &lt; params.size() - 1) ? '\\n    ' : '')}; return result&quot;</span><span class="token punctuation">,</span> <span class="token function">methodParameters</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
</code></pre></div><ul><li><code>@return</code>参数获取代码Groovy脚本</li></ul> <div class="language-groovy extra-class"><pre class="language-groovy"><code><span class="token comment">// 如果有返回参数使用一个空格作为参数后缀间隔符</span>
<span class="token function">groovyScript</span><span class="token punctuation">(</span><span class="token string gstring">&quot;def result=\&quot;<span class="token expression"><span class="token punctuation">$</span><span class="token punctuation">{</span><span class="token number">_1</span><span class="token punctuation">}</span></span>\&quot;; if(result == 'void'){return '';}else{return result+' ';}&quot;</span><span class="token punctuation">,</span> <span class="token function">methodReturnType</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
</code></pre></div><blockquote><p>使用时，直接在方法上输入<kbd>/</kbd>加上你的<code>Abbreviation</code>名字，再按<kbd>Tab</kbd>键即可获取方法上的参数</p></blockquote> <p><img src="/images/IDEA%E6%96%B9%E6%B3%95%E6%B3%A8%E9%87%8A%E8%AE%BE%E7%BD%AE.png" alt=""></p> <ul><li>示例</li></ul> <p><img src="/images/IDEA%E6%96%B9%E6%B3%95%E6%B3%A8%E9%87%8A%E7%A4%BA%E4%BE%8B.png" alt=""></p> <h2 id="鼠标悬停查看注释"><a href="#鼠标悬停查看注释" class="header-anchor">#</a> 鼠标悬停查看注释</h2> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>General</code></li> <li>勾选<code>Other</code>下的<code>Show quick documentation on mouse move</code>选项</li> <li>在<code>Other</code>下的<code>Tooltip delay</code>输入鼠标悬停时间单位<code>milliseconds(毫秒)</code></li></ul> <h2 id="注释自动缩进"><a href="#注释自动缩进" class="header-anchor">#</a> 注释自动缩进</h2> <blockquote><p>注释默认靠左，可能代码前会有很大一段空格</p></blockquote> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>Code Style</code> -&gt; <code>JAVA</code>、<code>HTML</code>、<code>JavaScript</code>、<code>XML</code>、<code>TypeScript</code>、<code>Groovy</code>、<code>Kotlin</code></li> <li>右边选择<code>Code Generation</code> -&gt; 取消勾选<code>Comment Code</code>下的<code>Line comment at first column</code>和<code>Block comment at first column</code></li></ul> <h2 id="自动优化导包"><a href="#自动优化导包" class="header-anchor">#</a> 自动优化导包</h2> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>General</code> -&gt; <code>Auto Import</code></li> <li>勾选<code>Add unambiguous imports on the fly</code>和<code>Optimize imports on the fly(for current project)</code>两个选项</li></ul> <blockquote><p><code>Add unambiguous imports on the fly</code> 自动帮我们优化导入的包，比如自动去掉一些没有用到的包。</p></blockquote> <blockquote><p><code>Optimize imports on the fly(for current project)</code> 自动帮我们导入需要用到的包。
但是对于同名的包，需要手动<kbd>Alt</kbd> + <kbd>Enter</kbd>进行导入。</p></blockquote> <h2 id="热部署策略"><a href="#热部署策略" class="header-anchor">#</a> 热部署策略</h2> <ul><li><a href="https://www.jetbrains.com/help/idea/updating-applications-on-application-servers.html" target="_blank" rel="noopener noreferrer">Updating Applications on Application Servers<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <ul><li>打开顶部菜单<code>Run</code> -&gt; <code>Edit Configurations</code> -&gt; 应用名称如<code>SpringBoot</code> -&gt; <code>目标项目</code> -&gt; <code>Configuration</code></li> <li>选择<code>Spring Boot</code> -&gt; <code>Update classes and resources</code>下的<code>On 'Update' action</code>和<code>On frame deactivation</code>两个选项</li></ul> <blockquote><p><code>On 'Update' action</code>当代码改变的时候做什么</p></blockquote> <blockquote><p><code>On frame deactivation</code>当失去焦点，比如最小化IDEA窗口的时候做什么</p></blockquote> <h2 id="自动编译"><a href="#自动编译" class="header-anchor">#</a> 自动编译</h2> <p><strong>动态</strong></p> <ul><li>同时按住<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Alt</kbd> + <kbd>/</kbd>然后点击<code>Registry</code>，勾选自动编译并调整延时参数。</li></ul> <ol><li><code>compiler.automake.allow.when.app.running</code>自动编译（动态）</li> <li><code>compiler.automake.trigger.delay</code>触发自动生成以响应文件系统事件之前的延迟（单位毫秒），默认300</li> <li><code>compiler.document.save.trigger.delay</code>触发保存以响应文档更改之前的延迟（单位毫秒），默认1500</li> <li><code>compiler.build.report.statistics</code>显示构建器的执行时间</li> <li><code>compiler.document.save.enabled</code>是否启用项目保存以响应文档更改</li> <li><code>compiler.external.javac.keep.alive.timeout</code>如果在指定的时间段或更长时间内未使用，则IDE将关闭缓存的javac编译过程</li></ol> <blockquote><p>修改完成后直接敲回车即保存</p></blockquote> <p><strong>静态</strong></p> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Build, Execution, Deployment</code> -&gt; <code>Compiler</code></li> <li>勾选<code>Build project automatically</code>自动构建项目，仅在未运行/调试时有效，静态</li> <li>勾选<code>Complie independent modules in parallel</code>并行编译独立模块，可能需要更大的堆大小</li></ul> <h2 id="去掉局部背景色"><a href="#去掉局部背景色" class="header-anchor">#</a> 去掉局部背景色</h2> <p><strong>去掉SQL检测</strong></p> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>Inspections</code> -&gt; <code>SQL</code></li> <li>取消勾选<code>No data sources configured</code>如果没有，则提示创建一个数据源。</li> <li>取消勾选<code>SQL dialect detection</code>为<code>&lt;Generic&gt;</code>方言中的文件检测最匹配的SQL方言。</li></ul> <p><strong>去掉背景</strong></p> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>Color Scheme</code> -&gt; <code>General</code> -&gt; <code>Code</code></li> <li>点击<code>Injected language fragment</code>，去掉最右边的<code>Background</code>选项。</li></ul> <h2 id="项目目录设置"><a href="#项目目录设置" class="header-anchor">#</a> 项目目录设置</h2> <p><img src="/images/IDEA%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84%E8%AF%B4%E6%98%8E.png" alt=""></p> <p><img src="/images/IDEA%E9%A1%B9%E7%9B%AE%E7%9B%AE%E5%BD%95%E6%8C%87%E5%AE%9A.png" alt=""></p> <h2 id="pycharm"><a href="#pycharm" class="header-anchor">#</a> PyCharm</h2> <p><strong>Python Script自定义头注释</strong></p> <ul><li><a href="#%E9%A2%84%E5%AE%9A%E4%B9%89%E6%A8%A1%E6%9D%BF%E5%8F%98%E9%87%8F">预定义模板变量</a></li></ul> <ul><li>在<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>File and Code Templates</code> -&gt; <code>Includes</code> -&gt; <code>File Header</code>中添加</li></ul> <div class="language-python extra-class"><pre class="language-python"><code><span class="token comment">#!/usr/bin/env python</span>
<span class="token comment"># -*- encoding: utf-8 -*-</span>
<span class="token comment">#</span>
<span class="token comment"># @Description: </span>
<span class="token comment"># @PreInstall: </span>
<span class="token comment"># @Author : ${USER}</span>
<span class="token comment"># @File : ${NAME}.py</span>
<span class="token comment"># @Version: 1.0.0</span>
<span class="token comment"># @Time : ${DATE} ${TIME}</span>
<span class="token comment"># @Project: ${PROJECT_NAME}</span>
<span class="token comment"># @Package: ${PACKAGE_NAME}</span>
<span class="token comment"># @Software: ${PRODUCT_NAME}</span>
</code></pre></div><ul><li>引用：打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>File and Code Templates</code> -&gt; <code>Files</code> <ul><li>在<code>Python Script</code>模板中第一行引用：<code>#parse(&quot;File Header&quot;)</code></li></ul></li></ul> <h3 id="自动导包"><a href="#自动导包" class="header-anchor">#</a> 自动导包</h3> <ul><li>打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>General</code> -&gt; <code>Auto Import</code> <ul><li>勾选<code>Python</code> -&gt; <code>Show import popup</code></li></ul></li></ul> <h3 id="函数注释"><a href="#函数注释" class="header-anchor">#</a> 函数注释</h3> <ul><li>打开 <code>File</code> -&gt; <code>Settings</code> -&gt; <code>Tools</code> -&gt; <code>Python Integrated Tools</code></li></ul> <ol><li><code>Docstring format</code> 选择格式：默认<code>Plain</code>（空的）、<code>Epytext</code>（Python2）、<code>reStructuredText</code>、<code>NumPy</code>、<code>Google</code></li> <li><code>Docstrings</code> -&gt; <code>Analyze Python code in docstrings</code> 分析文档字符串中的python代码</li> <li><code>Render external documentation for stdlib</code> 渲染stdlib的外部文档</li></ol> <ul><li>默认函数注释快捷键：<kbd>&quot;&quot;&quot;</kbd> + <kbd>Enter</kbd></li></ul> <blockquote><p>注意：如果使用函数注释时无法映射函数参数，在函数名中键入数遍光标，左上角亮起小灯泡，
点击小灯泡（或者使用快捷键<kbd>Alt</kbd> + <kbd>Enter</kbd>），再点击<code>Insert documentation string stub</code>选择注释格式</p></blockquote> <h2 id="goland"><a href="#goland" class="header-anchor">#</a> GoLand</h2> <p><strong>Go File自定义头注释</strong></p> <ul><li><a href="#%E9%A2%84%E5%AE%9A%E4%B9%89%E6%A8%A1%E6%9D%BF%E5%8F%98%E9%87%8F">预定义模板变量</a></li></ul> <ul><li>在<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>File and Code Templates</code> -&gt; <code>Includes</code> -&gt; <code>File Header</code>中添加</li></ul> <div class="language-go extra-class"><pre class="language-go"><code><span class="token comment">/**
 * 
 * @Description: 
 * @Author: ${USER}
 * @File: ${NAME}.go
 * @Version: 1.0.0
 * @Time: ${DATE} ${TIME}
 * @Project: ${PROJECT_NAME}
 * @Package: ${PACKAGE_NAME}
 * @Software: ${PRODUCT_NAME}
 */</span>
</code></pre></div><ul><li>引用：打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>File and Code Templates</code> -&gt; <code>Files</code></li> <li>在<code>Go File</code>模板中第一行引用：<code>#parse(&quot;File Header&quot;)</code></li></ul> <h2 id="webstorm"><a href="#webstorm" class="header-anchor">#</a> WebStorm</h2> <p><strong>JavaScript File自定义头注释</strong></p> <ul><li><a href="#%E9%A2%84%E5%AE%9A%E4%B9%89%E6%A8%A1%E6%9D%BF%E5%8F%98%E9%87%8F">预定义模板变量</a></li></ul> <ul><li>在<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>File and Code Templates</code> -&gt; <code>Includes</code> -&gt; <code>File Header</code>中添加</li></ul> <div class="language-js extra-class"><pre class="language-js"><code><span class="token comment">/**
 * 
 * @Description: 
 * @Author: ${USER}
 * @File: ${NAME}.js
 * @Version: 1.0.0
 * @Time: ${DATE} ${TIME}
 * @Project: ${PROJECT_NAME}
 * @Package: ${PACKAGE_NAME}
 * @Software: ${PRODUCT_NAME}
 */</span>
</code></pre></div><ul><li>引用：打开<code>File</code> -&gt; <code>Settings</code> -&gt; <code>Editor</code> -&gt; <code>File and Code Templates</code> -&gt; <code>Files</code> <ul><li>在<code>JavaScript File</code>模板中第一行引用：<code>#parse(&quot;File Header.js&quot;)</code></li></ul></li> <li>默认函数注释快捷键：<kbd>/**</kbd> + <kbd>Enter</kbd></li></ul></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/woytu/notes-vuepress/edit/master//IDE/IDEA设置.md" target="_blank" rel="noopener noreferrer">在 GitHub 上编辑此页</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2021-03-26 19:12:34</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/IDE/IDEA插件.html" class="prev">
        IDEA插件
      </a></span> <span class="next"><a href="/IDE/TextEditor.html">
        TextTditor
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><!----></div></div>
    <script src="/assets/js/app.269009d6.js" defer></script><script src="/assets/js/3.974b9720.js" defer></script><script src="/assets/js/20.1fb3f255.js" defer></script>
  </body>
</html>
